#ifndef __TRANSFER_RVDCDATA_H__
#define __TRANSFER_RVDCDATA_H__

#include <string.h>
#include <sstream>
#include <iomanip>
#include <exception>

#define TRANSFER_LOGNAME_LEN 64
#define TRANSFER_SHORT_DATASIZE 2
#define TRANSFER_DATASIZE 4
#define TRANSFER_LOGNAME_SIZE 64
#define TRANSFER_MIN_SIZE 76
#define TRANSFER_TYPE_SEQ 0
#define TRANSFER_RESERVED_SEQ 1
#define TRANSFER_LOGNAME_SEQ 4
#define TRANSFER_CHUNKNUM_SEQ 71
#define TRANSFER_FILESIZE_SEQ 75
#define TRANSFER_CHUNKSIZE_SEQ 79
#define TRANSFER_CHUNKPAYLOAD_SEQ 84
#define MAX_BUF_LEN 2048

class TransferRvdcData {
    public:
        TransferRvdcData();
        virtual ~TransferRvdcData();
        void parseRVDCBuf(const char* buf);
        std::string toString(uint8_t* buf, size_t size);
        int getDecNum(const char* buf, int seq, int length);
        int str2hex(std::string str);

    public:
        int mTransfertype;
        int mReserved;
        char* mLogname = NULL;
        int mChunknumber;
        int mFileSize;
        int mChunkSize;
        uint8_t* mChunkPayload = NULL;
        int totalLength = MAX_BUF_LEN;
};

#endif